#include <iostream>
using std::cout;
using std::endl;
#define MAX_COUNT 10

class Stack{
public:
    Stack():_count(0){}

    bool empty(){
        if(_count == 0){
            cout<<"stack empty"<<endl;
            return true;
        }else {
            cout<<"stack has "<<_count<<" num"<<endl;
            return false;
        }
    }

    bool full(){
        if(_count == MAX_COUNT-1){
            cout<<"stack full"<<endl;
            return true;
        }else{
            cout<<"stack has "<<_count<<" num"<<endl;
            return false;
        }
    }

    void push(int num){
        if(_count <MAX_COUNT){
        _num[_count] = num;
        cout<<"push success:"<<_num[_count]<<endl;
        _count +=1 ;
        }else{
            cout<<"Stack full"<<endl;
        }

    }
    
    void pop(){
        if(_count == 0){
            cout<<"Stack empty"<<endl;
        }else{
        cout<<"pop success "<<_num[_count-1]<<endl;
        _count -=1;
        }
    }

    int top(){
        if(_count == 0){
            cout<<"stack empty no top"<<endl;
            return 0;
        }else{
            cout<<"stack top:"<<_num[_count-1]<<endl;
        return _num[_count-1];
        }
    }

private:
    int _num[MAX_COUNT];
    int _count ;
};

void test(){
    Stack s1;
    s1.empty();
    s1.push(3);
    s1.push(2);
    s1.empty();
    s1.full();
    s1.top();
    s1.pop();
    s1.top();
}

int main()
{
    test ();
    return 0;
}

